<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>1</div>
    <div>1</div>
    <div>1</div>
    <div>1</div>
    <div>1</div>
    <script>
        /* 
            扩展运算符
                将数组或对象转为用逗号分隔的参数序列
         */

        let arry = [1, 2, 3];
        // ...arry：1,2,3
        console.log(...arry); // 等同于下面
        console.log(1, 2, 3);

        // 数组合并
        let arr1 = [1, 2, 3];
        let arr2 = [7, 8, 6];
        let arr3 = [...arr1, ...arr2];
        console.log(arr3);
        //或者
        arr1.push(...arr2); // 等同于 arr1.push(7,8,6)
        console.log(arr1);

        //伪数组转成真正数组
        var divs = document.getElementsByTagName('div');
        console.log(divs); //伪数组

        let divsArr = [...divs];
        console.log(divsArr);
        divsArr.push('span')
        console.log(divsArr);
    </script>
</body>

</html>